package yzx.fileutil.util;

import android.content.Context;
import android.widget.Toast;

public class ToastUtil {

    private static Toast t;

    public static void toast(Context context, String str, boolean longDuration){
        int time = longDuration? Toast.LENGTH_LONG:Toast.LENGTH_SHORT;
        if(t != null) t.cancel();
        t = Toast.makeText(context, str, time);
        t.show();
    }

    public static void toast(Context context, String str){
        toast(context, str, false);
    }

}
